package com.example.mobifin_busticket;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.util.Log;



public class BgMailandSmsService extends Service {
    /** interface for clients that bind */
    IBinder mBinder;
    /** indicates whether onRebind should be used */
    boolean mAllowRebind;

    /** Called when the service is being created. */
    @Override
    public void onCreate() {
        // not used
    }

    /** The service is starting, due to a call to startService() */
    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        String strEmail = intent.getStringExtra(AppData.EMAILID);
        String strSubject = intent.getStringExtra(AppData.SUBJECT);
        String strMailbody = intent.getStringExtra(AppData.MESSAGE);
        String strMailMessage = intent.getStringExtra(AppData.SMSBODY);
        String strTag = intent.getStringExtra(AppData.TAG);
        Log.d("Service Start", "" + strEmail + strTag);
        BusTicketManagaer.getInstance().sendEmailOrSMS(BgMailandSmsService.this,
                strEmail, strSubject, strMailbody, strTag, strMailMessage);
        return START_STICKY;
    }

    /** A client is binding to the service with bindService() */
    @Override
    public IBinder onBind(Intent intent) {
        return mBinder;
    }

    /** Called when all clients have unbound with unbindService() */
    @Override
    public boolean onUnbind(Intent intent) {
        return mAllowRebind;
    }

    /** Called when a client is binding to the service with bindService() */
    @Override
    public void onRebind(Intent intent) {
        // not used
    }

    /** Called when The service is no longer used and is being destroyed */
    @Override
    public void onDestroy() {
        // not used
    }
}